package com.lc.afbx.dialog;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.TextView;

import com.lc.afbx.BaseApplication;
import com.lc.afbx.R;

/**
 * Created by Administrator on 2016/10/27.
 */

public abstract class UpdateInfoDialog extends BaseDialog {

    private EditText msg;

    public UpdateInfoDialog(Context context, String title, String message) {

        super(context);

        setContentView(R.layout.dialog_update);

        BaseApplication.ScaleScreenHelper.loadView((ViewGroup) findViewById(R.id.dialog));

        msg = ((EditText) findViewById(R.id.alert_message));

        msg.setText(message);

        ((TextView) findViewById(R.id.alert_title_tv)).setText("修改" + title);

        View.OnClickListener listener = new View.OnClickListener() {

            @Override
            public void onClick(View v) {

                switch (v.getId()) {

                    case R.id.alert_confirm:

                        onConfirm(msg.getText().toString().trim());

                        break;
                }

                dismiss();

            }

        };


        findViewById(R.id.alert_cancel).setOnClickListener(listener);
        findViewById(R.id.alert_confirm).setOnClickListener(listener);


    }


    protected abstract void onConfirm(String string);


}

